package com.java1412.controller;

import com.java1412.dto.HouseInfoDTO;
import com.java1412.entity.HouseInfo;
import com.java1412.service.HouseInfoService;
import com.java1412.utils.PageUtil;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author java1412
 * @since 2025-04-30 13:45
 */
@RestController
@RequestMapping(value = "/houseInfo")
@CrossOrigin    // 允许跨域
public class HouseInfoController {

    @Resource
    private HouseInfoService houseInfoService;

    @GetMapping
    public PageUtil<HouseInfo> find(HouseInfoDTO houseInfoDTO) {
        PageUtil<HouseInfo> pageUtil = houseInfoService.find(houseInfoDTO);
        return pageUtil;
    }

    @PostMapping
    // public Map<String, Object> add(HouseInfoDTO houseInfoDTO) {
    public Map<String, Object> add(@RequestBody HouseInfoDTO houseInfoDTO) {
        return houseInfoService.add(houseInfoDTO);
    }
}
